#pragma once

#include <ECS/ECS.h>
#include <ECS/Math/Vec2.h>
#include <AgentAI/AI.h>
#include "Gameplay/Fraction.h"

class GameObject;

struct AIComponentDef
{
	mtMETA_DEC;
	int fraction;
};


class AIComponent : public ECS::Component
{
	mtMETA_DEC;
public:
	AIComponent();
	bool initWith(AIComponentDef* def);

	ai::AIActor* getActor() const;

	Fraction* getFraction() const;
	void setFraction(Fraction* fraction);

	void onStart();
	void onUpdate();

	/// Temporary
	GameObject* target;
	GameObject* nearestEnemy;
	GameObject* nearestItem;
	ECS::Vec2<int> prevPosition;
protected:
	Fraction* _fraction;
	ai::AIActor* _actor;
};